# Copyright (c) 2021 by xfangfang. All Rights Reserved.

import os
import sys
import logging
from macast import SETTING_DIR
from macast.macast import cli

logger = logging.getLogger("Macast")
logger.setLevel(logging.DEBUG)

def get_base_path(path="."):
    if getattr(sys, 'frozen', False) and hasattr(sys, '_MEIPASS'):
        base_path = sys._MEIPASS
    else:
        base_path = os.getcwd()
    return os.path.join(base_path, path)

def clear_env():
    # todo clear pyinstaller file on start
    log_path = os.path.join(SETTING_DIR, 'macast.log')
    try:
        os.remove(log_path)
    except:
        pass


if __name__ == '__main__':
    clear_env()
    cli()
